.navbar {
  --headerNavFontSize: calc((16 / 16) * 1rem);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  width: var(--space2XL);
  position: fixed;
  top: var(--spaceOuter);
  left: var(--spaceOuter);
  bottom: var(--spaceOuter);
  z-index: var(--zIndex4);
  isolation: isolate;

  @media (--mediaMobile) {
    --headerNavFontSize: calc((22 / 16) * 1rem);
  }

  @media (--mediaMobile), (--mediaMobileLS) {
    bottom: auto;
  }
}

.logo {
  display: flex;
  position: relative;
  padding: var(--spaceS) var(--spaceS) var(--spaceL);
  z-index: var(--zIndex2);

  @media (--mediaMobile) {
    padding-bottom: var(--spaceS);
  }
}

.nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex: 1 1 auto;
  max-width: var(--space2XL);

  @media (--mediaMobile), (--mediaMobileLS) {
    display: none;
  }
}

.navList {
  transform: rotate(-90deg) translate3d(-50%, 0, 0);
  display: flex;
  flex-direction: row-reverse;
  position: relative;
  top: calc(var(--spaceM) * -1);
}

.navLink {
  padding: var(--spaceM);
  color: rgb(var(--rgbText) / 0.8);
  font-weight: var(--fontWeightMedium);
  font-size: var(--headerNavFontSize);
  text-decoration: none;
  position: relative;
  transition: color var(--durationS) ease 0.1s;
  line-height: 1;
  display: inline-flex;
  align-items: center;

  &:hover,
  &:active,
  &:focus,
  &[aria-current='page'] {
    color: var(--colorTextBody);
  }

  &::after {
    content: '';
    position: absolute;
    right: var(--spaceS);
    left: var(--spaceS);
    height: 4px;
    background: rgb(var(--rgbAccent));
    transform: scaleX(0);
    transform-origin: right;
  }

  @media (--mediaUseMotion) {
    &::after {
      transition: transform var(--durationM) var(--bezierFastoutSlowin);
    }
  }

  &:hover::after,
  &:active::after,
  &:focus::after,
  &[aria-current='page']::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

.navIcons {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: var(--zIndex2);

  @media (--mediaMobile), (--mediaMobileLS) {
    flex-direction: row;
    position: absolute;
    bottom: var(--spaceXL);
    left: var(--spaceXL);
  }

  @media (max-width: 820px) and (max-height: 420px) {
    left: var(--spaceL);
    transform: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

.navIconLink {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spaceS);
  width: var(--space2XL);
  height: var(--space2XL);
  color: var(--colorTextLight);
  transition: color var(--durationM) var(--bezierFastoutSlowin);

  &:hover,
  &:focus,
  &:active {
    color: rgb(var(--rgbAccent));
  }
}

.navIcon {
  fill: currentColor;
  transition: fill var(--durationM) ease;
}

.mobileNav {
  position: fixed;
  inset: 0;
  background: rgb(var(--rgbBackground) / 0.9);
  transform: translate3d(0, -100%, 0);
  transition-property: background;
  transition-duration: var(--durationL);
  transition-timing-function: var(--bezierFastoutSlowin);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);

  @media (--mediaMobile), (--mediaMobileLS) {
    display: flex;
  }

  @media (--mediaUseMotion) {
    transition-property: transform, background;
    transform: translate3d(0, -100%, 0);
  }

  &[data-visible='true'] {
    transform: none;
  }
}

.mobileNavLink {
  width: 100%;
  font-size: var(--headerNavFontSize);
  text-align: center;
  text-decoration: none;
  color: var(--colorTextBody);
  padding: var(--spaceL);
  opacity: 0;
  transition-property: opacity;
  transition-duration: var(--durationS);
  transition-timing-function: var(--bezierFastoutSlowin);
  transition-delay: var(--transitionDelay);
  position: relative;
  top: calc(var(--spaceM) * -1);

  @media (--mediaUseMotion) {
    transition-property: transform, opacity;
    transform: translate3d(0, calc(var(--spaceXL) * -1), 0);
  }

  @media (max-width: 820px) and (max-height: 420px) {
    top: auto;
  }

  @media (--mediaMobileS), (max-height: 360px) {
    --headerNavFontSize: calc((18 / 16) * 1rem);
  }

  &::after {
    content: '';
    position: absolute;
    top: 50%;
    right: var(--space3XL);
    left: var(--space3XL);
    height: 4px;
    background: rgb(var(--rgbAccent));
    transform: scaleX(0) translateY(-1px);
    transform-origin: right;
  }

  @media (--mediaUseMotion) {
    &::after {
      transition: transform var(--durationM) var(--bezierFastoutSlowin);
    }
  }

  &:hover::after,
  &:active::after,
  &:focus::after {
    transform: scaleX(1) translateY(-1px);
    transform-origin: left;
  }

  &[data-visible='true'] {
    opacity: 1;
    transform: none;
  }
}
